package com.Triocean;

import com.Core.GameEngine;
import com.Database.GameDatabase;
import com.GameComponent.SplashScreen;
import com.Triocean.R;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;

public class TrioceanActivity extends Activity
{	@Override
	public void onCreate(Bundle savedInstanceState)
	{	super.onCreate(savedInstanceState);
		setContentView(R.layout.logo_screen);
		GameEngine.globalContext = getApplicationContext();
		GameEngine.display = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
		
		GameEngine.loaderThread=new Thread()
		{	public void run()
			{	GameEngine.gameDb = new GameDatabase(GameEngine.globalContext);
				GameEngine.profile = GameEngine.gameDb.GetProfile();
				GameEngine.dataAllLoaded = true;
			}
		};
		GameEngine.loaderThread.start();
		
		new Handler().postDelayed
		(	new Thread()
			{	@Override
				public void run()
				{	Intent splashScreen=new Intent(TrioceanActivity.this, SplashScreen.class);
					TrioceanActivity.this.startActivity(splashScreen);
					TrioceanActivity.this.finish();
					TrioceanActivity.this.overridePendingTransition(R.layout.appear, R.layout.fadeout);
				}
			},
			GameEngine.LOGO_SCREEN_TIME
		);
	}
}